www.gusucode.com > 无线传感器网络定位算法 matlab源代码 包含七个算法matlab源码程序 > Localization/Topology Of WSN/Transmission Model/Logarithmic Attenuation Model/rss2dist.m

    function dist=rss2dist(RSS)
%~~~~~~~~Logarithmic Attenuation Model~~~~~~~~~
%   In this model, the radio range is a circle
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% ReceivedSignalStrength=SendingPower-PathLoss+Fading
% e.g, RSS=Pt-Pl(d0)-10*η*log10(dist/d0)+Xσ
% Pt:transmit power
% pl(d0):the pass loss for a reference distance of d0
% ηis the path loss exponent
% Xσ:Gaussian random variable of zero mean and σ^2variance N(0,σ^2) σ=4~10
% above parameters are saved in '../Parameters_Of_Models.mat'
% dist:distance between sender and receiver(m)
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% mean(Xσ)=0, needn't take it into consideration when translating RSS to distance 
% ==>dist=d0*10.^((Pt-Pl_d0-RSS)./(10*eta))   
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% typical value:Pt=0-4dBm(max),Pl(d0)=55dB(d0=1m),η(2~4)=4(indoor,outdoor)
    load '../Parameters_Of_Models.mat';
    dist=d0*10.^((Pt-Pl_d0-RSS)./(10*eta));
end